FROM microsoft/dotnet:2.2-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM microsoft/dotnet:2.2-sdk AS build
WORKDIR /src
COPY ["WQLWebAPI.Api/WQLWebAPI.Api.csproj", "WQLWebAPI.Api/"]
COPY ["WQLWebAPI.Mongodb/WQLWebAPI.Mongodb.csproj", "WQLWebAPI.Mongodb/"]
COPY ["WQLWebAPI.Domain/WQLWebAPI.Domain.csproj", "WQLWebAPI.Domain/"]
COPY ["WQLWebAPI.Infrastructure/WQLWebAPI.Infrastructure.csproj", "WQLWebAPI.Infrastructure/"]
COPY ["WQLWebAPI.Application/WQLWebAPI.Application.csproj", "WQLWebAPI.Application/"]
RUN dotnet restore "WQLWebAPI.Api/WQLWebAPI.Api.csproj"
COPY . .
WORKDIR "/src/WQLWebAPI.Api"
RUN dotnet build "WQLWebAPI.Api.csproj" -c Release -o /app

FROM build AS publish
RUN dotnet publish "WQLWebAPI.Api.csproj" -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "WQLWebAPI.Api.dll"]